<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class DropLoanApplyLoanRequestIdUniqueToLoanApply extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('loan_apply', function (Blueprint $table) {
          $table->dropIndex('loan_apply_loan_id_unique');
          $table->dropIndex('loan_apply_loan_request_id_unique');
          $table->index('user_id');
          $table->index('loan_request_id');
          $table->index('loan_status');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('loan_apply', function (Blueprint $table) {
            $table->unique('loan_request_id','loan_apply_loan_request_id_unique');
            $table->unique('loan_id','loan_id');
        });
    }
}
